import { http } from "@/utils/http";

/** 获取角色列表 */
export const getRoleList = () => {
  return http.request<any>("get", "/role/getRoleList");
};

/** 添加角色 */
export const addRole = (data?: object) => {
  return http.request<any>("post", "/role/addRole", { data });
};

/** 修改角色 */
export const updateRole = (data?: object) => {
  return http.request<any>("put", "/role/updateRole", { data });
};

/** 删除角色 */
export const deleteRole = (data?: object) => {
  return http.request<any>("delete", "/role/deleteRole", { data });
};

/** 取消菜单分配 */
export const cancelDistributionMenu = (data?: object) => {
  return http.request<any>("delete", "/role/cancelDistributionMenu", { data });
};

/** 取消用户分配 */
export const cancelDistributionUser = (data?: object) => {
  return http.request<any>("delete", "/role/cancelDistributionUser", { data });
};

/** 为角色分配权限 */
export const distributionMenu = (data?: object) => {
  return http.request<any>("post", "/role/distributionMenu", { data });
};

/** 为角色分配用户 */
export const distributionUser = (data?: object) => {
  return http.request<any>("post", "/role/distributionUser", { data });
};

/** 获取已经角色分配的用户 */
export const getUserListByRoleId = (params?: object) => {
  return http.request<any>("get", "/role/getUserListByRoleId", { params });
};

/** 获取已经角色分配的权限 */
export const getMenuListByRoleId = (params?: object) => {
  return http.request<any>("get", "/role/getMenuListByRoleId", { params });
};
